package com.darrendb.utils {
	
	import flash.display.MovieClip;
	import flash.utils.Timer;
    import flash.events.TimerEvent;
   	import com.darrendb.utils.PopupAutoCloseTimerEvent;
   
    public class PopupAutoCloseTimer extends Timer {
		
		private var _target_mc:MovieClip;
		public function get target_mc():MovieClip{ return _target_mc; }
		public function set target_mc(value:MovieClip):void{ _target_mc = value; }

		public function PopupAutoCloseTimer(p_delay:uint, p_repeat:uint, p_target_mc:MovieClip) {
			target_mc = p_target_mc;
			super(p_delay, p_repeat);
			addEventListener(TimerEvent.TIMER_COMPLETE, handleTimerComplete, false, 0, true);
		}

		private function handleTimerComplete(e:TimerEvent):void {
			dispatchEvent(new PopupAutoCloseTimerEvent( PopupAutoCloseTimerEvent.TIMER_COMPLETE, target_mc) );
		}

	}// end class
	
}// end package